use thiserror::Error;

use crate::parser::Token;

#[derive(Debug, Error)]
pub enum PlundererError {
    // #[error("Regex pattern '{pattern}' failed to match '{target}'")]
    // RegexFailedError { pattern: String, target: String },
    #[error("Expected {expected:?} but found {found:?}")]
    SyntaxError { expected: Vec<Token>, found: Token },

    #[error("Syntax EOF: expected {expected:?}")]
    SyntaxEofError { expected: Vec<Token> },

    #[error("{existing} is provided already, but {new} is newly found")]
    DuplicateError { existing: String, new: String },

    #[allow(dead_code)]
    #[error("Not implemented")]
    NotImplementedError,

    #[error("File not found: {0}")]
    FileNotFoundError(String),

    #[error("Column not found: {0}")]
    ColumnNotFoundError(String),

    #[error("Column index out of bound: {idx} > {bound}")]
    ColumnIndexOutOfBoundsError { idx: usize, bound: usize },

    #[error("Cannot designate column header while the file has no header line!")]
    ColumnHeaderDesignationError,
}
